package practice_0526;

import static java.lang.Thread.sleep;

public class practice01 {
    public static void main(String[] args) {
//        Thread thread = new Thread(new cat());
//        thread.start();
//        System.out.println(thread.getName());
        cat cat = new cat();
        cat.start();
        for (int i = 0; i < 30; i++) {
            System.out.println(i + Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }

    }
}

class cat extends Thread{

    @Override
    public void run() {
        int count = 0;
        while(true) {
            System.out.println("小猫喵喵叫..... " + ++count);
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if(count == 50){
                break;
            }
        }
    }
}
